/*
 * IOCard.cc
 *
 *  Created on: Apr 2, 2012
 *      Author: s90085
 */

#include "IOCard.h"

IOCard::IOCard(){
	buffers = new TripleBuffer(new CameraBuffer(),new CameraBuffer(),new CameraBuffer());
}

IOCard::~IOCard(){
	delete buffers;
}


void IOCard::receiveImageFromCamera(int cameraNumber, byte image){
	if (CameraBuffer* tmpBuffer = dynamic_cast<CameraBuffer*>(buffers->getFillBuffer())){
		tmpBuffer->setBeeld(cameraNumber, image);
	}
}

Buffer* IOCard::getReadBuffer(){
	return buffers->getReadBuffer();
}


void IOCard::swapCamera(int cameraNumber, Buffer* newBuffer ){
	buffers->replaceBuffer(cameraNumber, newBuffer);
}
